<template>
    <div>
        <el-card class="!border-none" shadow="never">
            <el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
                <el-form-item label="用户ID">
                    <el-input
                            class="w-[150px]"
                            v-model="queryParams.uuid"
                            placeholder="请输入用户ID"
                            clearable
                            @keyup.enter="resetPage"
                    />
                </el-form-item>
                <el-form-item label="用户昵称/姓名/手机号">
                    <el-input
                            class="w-[280px]"
                            v-model="queryParams.user_keyword"
                            placeholder="请输入用户昵称/姓名/手机号"
                            clearable
                            @keyup.enter="resetPage"
                    />
                </el-form-item>
                <el-form-item label="团长ID搜索">
                    <el-input
                            class="w-[280px]"
                            v-model="queryParams.community_user_id"
                            placeholder="请输入团长ID"
                            clearable
                            @keyup.enter="resetPage"
                    />
                </el-form-item>
                <el-form-item label="团长手机号/昵称搜索">
                    <el-input
                            class="w-[280px]"
                            v-model="queryParams.community_keyword"
                            placeholder="请输入团长ID"
                            clearable
                            @keyup.enter="resetPage"
                    />
                </el-form-item>

                <el-form-item label="领取时间">
                    <daterange-picker
                        v-model:startTime="queryParams.start_time"
                        v-model:endTime="queryParams.end_time"
                    />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none mt-4" shadow="never">
            <el-tabs class="demo-tabs">
                <el-table size="large" v-loading="pager.loading" :data="pager.lists" style="width: 100%">
                    <el-table-column label="用户ID / 手机号 / 昵称" prop="name" min-width="220">
                        <template #default="{ row }">
                            {{ row.uuid }} / {{ row.phone }} / {{ row.nickname }}
                        </template>
                    </el-table-column>
                    <el-table-column label="团长ID / 手机号 / 昵称" prop="name"  min-width="220">
                        <template #default="{ row }">
                            {{ row.community_uuid }} / {{ row.community_phone }} / {{ row.community_name }}
                        </template>
                    </el-table-column>
                    <el-table-column label="积分记录ID" prop="red_id"  min-width="120" />
                    <el-table-column label="商家批次单号" prop="batch_id"  min-width="250" />
                    <el-table-column label="商家明细单号" prop="out_detail_no"  min-width="150" />
                    <el-table-column label="积分金额" prop="sign_red"  min-width="120" />
					<el-table-column label="接口费" prop="red_fee"  min-width="100" />
					<el-table-column label="发放状态" prop="status_name"  min-width="100" />

                </el-table>
                <div class="flex justify-end mt-4">
                    <pagination v-model="pager" @change="getLists" />
                </div>
            </el-tabs>
        </el-card>
    </div>
</template>
<script lang="ts" setup>
    import { reissue, exchangeList } from '@/api/consumer'
    import { usePaging } from '@/hooks/usePaging'
    import feedback from "@/utils/feedback";
    import router, { getRoutePath } from '@/router'

    const queryParams = reactive({
        uuid: '',
        user_keyword: '',
        community_user_id: '',
        community_keyword: '',
        start_time: '',
        end_time: '',
		room_id:'',
		sign_red:''
    });

    const { pager, getLists, resetPage, resetParams } = usePaging({
        fetchFun: exchangeList,
        params: queryParams
    });

    getLists();
	let price:any = []
    // 补发
    const userDelete = async (id: number) => {
     price = await feedback.prompt("请输入补发积分金额","补发积分");
	 console.log(price)
	 if(price.action=="confirm"){
		 reissue({log_id: id,reissue_price:price.value});
		 getLists()
	 }

    };

</script>
